
export enum env {
    "production" = "prod",
    "uat" = "uat",
    "test" = "test",
    "local" = "local"
}

export class Config {
    static environment = env.test;//当前环境
    // static environment = env.uat;//uat环境
    // static environment = env.production;//生产环境
}

//自动获取配置
function getRequest() {
    let search: string = window.location.search;
    if (search == undefined || search == "" || search == null) {
        // search = this._defaultSearch;
    }
    let url = search
    if (!url || url == "") {
        return {};
    }
    var query: any = {};
    var i: number;
    var str: string;
    var strs: string[];
    var arr: string[];
    if (url.indexOf("?") != -1) {
        str = url.substr(1);
        strs = str.split("&");
        for (i = 0; i < strs.length; i++) {
            arr = strs[i].split("=");
            query[arr[0]] = unescape(arr[1]);
        }
    }
    Config.environment = query.env
    return query;
}
// getRequest()


// function addVConsole() {
//     if (Config.environment == env.test) { //|| Config.environment == env.uat
//         if (!CC_EDITOR) {
//             let script = document.createElement("script");
//             script.type = "text/javascript";
//             script.src = 'https://cdn.bootcss.com/vConsole/3.3.0/vconsole.min.js'
//             script.async = true;
//             var engineLoaded = function () {
//                 document.body.removeChild(script);
//                 script.removeEventListener('load', engineLoaded, false);
//                 new VConsole();
//             };
//             script.addEventListener('load', engineLoaded, false);
//             document.body.appendChild(script);
//         }
//     }
// }
// addVConsole();


// Request: { //请求码
//     JOIN_ROOM: 3000, //加入房间
//     SEND_MSG: 3001, //发送消息
//     SEND_OFFLINE_MSG: 3005, //发送离线消息
// },
// Response: { //返回吗
//     STSTEM_MSG: 1003, //系统消息
//     RECEIVE_MSG: 3002, //接收消息
//     ROOM_INFO: 3003, //房间消息
//     RECEIVE_OFFLINE_MSG: 3004, //获取离线消息
// },

